/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.tree.tree;

/**
 * 树的叶子节点
 *
 * @author jzj
 * @data 2009-12-17
 *
 */
public class TreeLeafNode extends TreeNode {
    public TreeLeafNode(int nodeId, String nodeName) {
        this.setNodeId(nodeId);
        this.setNodeName(nodeName);
    }

    // 获取叶子节点信息
    protected StringBuffer getNodeInfo() {
        StringBuffer sb = new StringBuffer();

        // 打印缩进
        for (int i = 0; i < this.getDepth(); i++) {
            sb.append(' ');
        }
        sb.append("---");

        sb.append("[nodeId=");
        sb.append(this.getNodeId());
        sb.append(" nodeName=");

        sb.append(this.getNodeName());
        sb.append(']');

        return sb;
    }

    public String toString() {
        return getNodeInfo().toString();
    }
}